package com.kgc.storeprovider.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.store.pojo.Quality;
import com.kgc.store.remote.QualityRemote;
import com.kgc.storeprovider.service.QualityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class QualityController implements QualityRemote {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private QualityService qualityService;

    @Override
    public ResponseMsg getQualityList(Map<String, Object> map) {
        logger.info("QualityController getQualityList map:"+map);
        ResponseMsg msg = qualityService.getQualityList(map);
        logger.debug("QualityController getQualityList msg:"+msg);
        return msg;
    }

    @Override
    public ResponseMsg delQuality(String code) {
        logger.info("QualityController delQuality code:"+code);
        ResponseMsg msg = qualityService.delQuality(code);
        logger.debug("QualityController delQuality msg:"+msg);
        return msg;
    }

    @Override
    public ResponseMsg addQuality(Quality quality) {
        logger.info("QualityController addQuality quality:"+quality);
        ResponseMsg msg =qualityService.addQuality(quality);
        logger.debug("QualityController addQuality msg:"+msg);
        return msg;
    }

    @Override
    public ResponseMsg selectQualityType() {
        logger.info("QualityController selectQualityType ist start...");
        ResponseMsg msg = qualityService.selectQualityType();
        logger.debug("QualityController selectQualityType msg:"+msg);
        return msg;
    }

    @Override
    public ResponseMsg selectQualityDetailByCGDD(String cgddCode) {
        logger.info("QualityController selectQualityDetailByCGDD ist start...");
        ResponseMsg msg = qualityService.selectQualityDetailByCGDD(cgddCode);
        logger.debug("QualityController selectQualityDetailByCGDD msg:"+msg);
        return msg;
    }

}
